<?php session_start(); ?>
<!doctype html>
<html>
<head>
	<title>File Manager</title>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
	<script type="text/javascript" src="js/ajax.js"></script>
	<script type="text/javascript" src="js/filemanager.js"></script>
	<link rel="stylesheet" href="css/styles.css"/>
</head>
<body>
	<!-- placeholder để hiển thị danh sach các file hoặc thư mục -->
	<div class="datagrid" id="file_datagrid"></div>
	
	<div id="toolbar">
		<input type="button" id="insert_image" style="margin-right:5px;" value="Chèn ảnh"/>
		<img src="img/open.gif" id="btn_open" title="Download/Open" alt="Download/Open"/>
		<img src="img/new.gif" id="btn_new_folder" title="New" alt="New"/>
		<img src="img/upload.gif" id="btn_upload" title="Upload" alt="Upload"/>
		<img src="img/rename.gif" id="btn_rename" title="Rename" alt="Rename"/>
		<img src="img/delete.gif" id="btn_delete" title="Delete" alt="Delete"/>
		<form action="process.php?new" id="form_new" method="post" style="display:none;">
			<input type="text" name="name" id="form_new_name"/>
			<input type="submit" id="form_new_submit" value="Ok"/>
			<input type="reset" id="form_new_reset" value="Cancel"/>
		</form>
		<form action="process.php?rename" id="form_rename" method="post" style="display:none;">
			<input type="text" name="name" id="form_rename_name"/>
			<input type="submit" id="form_rename_submit" value="Ok"/>
			<input type="reset" id="form_rename_reset" value="Cancel"/>
		</form>
		<form action="upload.php" id="form_upload" method="post" enctype="multipart/form-data" style="display:none;">
			<input type="file" name="file" id="form_upload_name" />
			<input type="hidden" name="directory" id="form_upload_directory" value=""/>
			<input type="submit" id="form_upload_submit" value="Ok"/>
			<input type="reset" id="form_upload_reset" value="Cancel"/>
		</form>
		<input type="hidden" id="user_id" value="<?php echo $_SESSION['user_id']?>"/>
		<!-- phần tử iframe cần cho việc upload. Ý tưởng ở đây là form_upload sẽ target đến iframe khi submit, 
			 Kết quả sẽ trả về cho iframe. Điều này tạo ra ảo giác răng việc upload anh diễn ra ở bên dưới ứng dụng -->
		<iframe id="my_iframe" name="my_iframe" style="display:none;"></iframe>
	</div>
</body>
</html>
